home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CU Amiga Super CD-ROM 22
/
CU Amiga Magazine's Super CD-ROM 22 (1998)(EMAP Images)(GB)[!][issue 1998-05].iso
/
PowerPC
/
Programming
/
PPCsiod
/
SIOD
/
Debug.scm
< prev
next >
Wrap
Text File
|
1993-09-24
|
2KB
|
47 lines
(define (break proc . nome)
(let ((code (procedure-code proc)))
(set-cdr! code (list 'begin
(list 'bkpt (if (string? (car nome))
(car nome)))
(cdr code)))
(set-procedure-code! proc code)))
(define (unbreak proc)
(let ((code (procedure-code proc)))
(if (eq? (caaddr code) 'bkpt)
(set-cdr! code (cadddr code))
(error "procedure is not breaked"))
(set-procedure-code! proc code)))
(define (*tracer* nome env)
(if (string? nome)
(display nome)
(display "entering procedure with parameters:"))
(do ((ar (environment-bindings env) (cdr ar)))
((null? ar))
(print (cdar ar))
(newline)))
(define (trace proc . nome)
(let ((code (procedure-code proc)))
(set-cdr! code
(list 'begin
(list '*tracer* (if (string? (car nome))
(car nome))
(list 'the-environment))
(cdr code)))
(set-procedure-code! proc code)))
(define (untrace proc)
(let ((code (procedure-code proc)))
(if (eq? (caaddr code) '*tracer*)
(set-cdr! code (cadddr code))
(error "procedure is not traced"))
(set-procedure-code! proc code)))
(macro assert (lambda (x)
`(if ,(cadr x)
#t
(bkpt ,@(cddr x)))))